package com.FundamentalDemos.Function;

import java.util.Scanner;

public class 使用return {
    public static void main(String[] args) {

        System.out.println("程序开始...");
        Scanner sc = new Scanner(System.in);
        double t1, t2;
        String temp;
        while (true) {
            System.out.print("请输入被除数和除数:");
            divide(t1 = sc.nextDouble(), t2 = sc.nextDouble());
            System.out.println("是否继续...?(Y/N)");
            if ((temp = sc.next()).equals("N")) {
                break;
            }
        }
        System.out.println("程序结束...");

    }

    private static void divide(double i, double i1) {
        if (i1 == 0) {
            System.out.println("除数不允许为0,请重输!");
            return;
        }
        double temp = i / i1;
        System.out.println("除法结果是:" + temp);
    }
}
